<template>
  <div class="index-pages">
    <div class="first-screen">
      <div class="index-info-box">
        <img class="info-title" src="/images/index-title.png" />
        <div class="info-content">链接仪器·数据·教学，赋能教育数字化转型</div>
        <div class="info-button" @click="handleToLogin">
          <div class="info-button-text">立即体验</div>
          <img src="@/assets/icon-link-white.png" class="info-button-icon" />
        </div>
      </div>
      <div
        class="swipper-box"
        @mouseenter="pauseAutoplay"
        @mouseleave="resumeAutoplay"
      >
        <swiper
          :pauseOnHover="true"
          :slidesPerView="3"
          :modules="modules"
          :spaceBetween="33"
          :loop="true"
          :autoplay="autoplayOptions"
          class="mySwiper"
          ref="swiperRef"
        >
          <swiper-slide v-for="(item, index) in swiperList" :key="index">
            <div class="swipper-item">
              <div class="swipper-item-content">
                <div class="swipper-item-title">{{ item.title }}</div>
                <div class="swipper-item-desc">{{ item.desc }}</div>
                <div @click="handleGoTo(item.link)" class="swipper-item-link">
                  查看详情
                </div>
              </div>
              <img :src="item.img" class="swipper-item-img" />
            </div>
          </swiper-slide>
        </swiper>
      </div>
    </div>
    <div class="column-1-box">
      <div class="main-box">
        <div class="box-lf">
          <div class="title">AI实验助手<br />轻松学习</div>
          <div class="menu-list">
            <div
              class="item"
              v-for="(value, index) in menuList"
              :key="value.title"
              :class="{ active: activeIndex == index }"
              @mouseenter="switchMenu(index)"
            >
              <div class="title">{{ value.title }}</div>
              <div class="content" v-if="activeIndex == index">
                {{ value.content }}
              </div>
            </div>
          </div>
        </div>
        <div class="box-rt"></div>
      </div>
    </div>
    <div class="column-2-box">
      <div class="title">3D虚拟仿真实验</div>
      <div class="out-box">
        <div class="bg"></div>
        <div class="main-box">
          <div class="box-lf">
            <div class="lf-title">优势&特点</div>
            <div class="lf-sub-title">3D建模技术，沉浸式操作体验</div>
            <div class="menu-list">
              <div
                class="item"
                v-for="(value, index) in menuList2"
                :key="value.title"
                :class="{ active: activeIndex2 == index }"
                @mouseenter="switchMenu2(index)"
              >
                {{ value.title }}
              </div>
            </div>
          </div>
          <div class="box-rt" v-if="activeIndex2 == 0">
            <div class="rt-title">高精度仿真，还原真实实验场景</div>
            <div class="rt-content">
              物理引擎和AI算法相结合，模拟真实物理规律，使复杂实验的仿真准确率显著提升，并支持实时交互。AI可以实时解答学生在实验预习、操作和报告撰写过程中的疑问，确保学生在遇到问题时能够及时获得帮助，避免因问题积累而影响学习效果。
            </div>
            <div class="three">
              <div class="item">
                <div class="icon"></div>
                <div class="text">实时交互</div>
              </div>
              <div class="item">
                <div class="icon"></div>
                <div class="text">AI实时解答</div>
              </div>
              <div class="item">
                <div class="icon"></div>
                <div class="text">准确率提升</div>
              </div>
            </div>
            <!-- 待解决：这里可能有点击跳转事件 -->
            <div class="btn" @click="handleToLogin">了解详情</div>
          </div>
          <div class="box-rt" v-if="activeIndex2 == 1">
            <div class="rt-title">降低实验成本，提高资源利用率</div>
            <div class="rt-content">
              减少昂贵实验设备、耗材的损耗，解决高校实验设备不足问题，让更多学生获得实操机会。
            </div>
            <div class="three"></div>
            <div class="btn" @click="handleToLogin">了解详情</div>
          </div>
          <div class="box-rt" v-if="activeIndex2 == 2">
            <div class="rt-title">支持个性化学习与自适应训练</div>
            <div class="rt-content">
              支持教学或自学模式，适应不同学习阶段需求。<br />
              实时反馈操作错误，帮助学生针对性改进
            </div>
            <div class="three"></div>
            <div class="btn" @click="handleToLogin">了解详情</div>
          </div>
          <div class="box-rt" v-if="activeIndex2 == 3">
            <div class="rt-title">过程可溯，优化教学评估</div>
            <div class="rt-content">
              自动记录操作步骤，便于教师精准评估，帮助学生复盘错误操作
            </div>
            <div class="three"></div>
            <div class="btn" @click="handleToLogin">了解详情</div>
          </div>
        </div>
      </div>
    </div>
    <div class="column-3-box">
      <div class="column-3-title">平台优势</div>

      <img src="/images/column-3.png" class="column-img" alt="" />
    </div>
    <div class="column-4-box">
      <div class="column-title">合作院校</div>
      <div class="column-content">
        <div class="logo-img">
          <img src="/images/partner/北华大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/北京城市学院.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/河北工业大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/南开大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/石家庄职业技术学院.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津电子信息职业技术学院.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津工业大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津工业职业学院.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津科技大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津理工大学中环信息学院.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/天津师范大学.png" alt="" />
        </div>
        <div class="logo-img">
          <img src="/images/partner/中国民航大学.png" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import { Swiper, SwiperSlide } from "swiper/vue";
import "swiper/css";
// 引入所需模块（按需导入）
import { Autoplay } from "swiper/modules";
const modules = [Autoplay];
const router = useRouter();
const swiperRef = ref(null);
const autoplayOptions = ref({
  delay: 2500,
  disableOnInteraction: false,
  pauseOnMouseEnter: true,
});

const pauseAutoplay = () => {
  if (swiperRef.value && swiperRef.value.swiper) {
    swiperRef.value.swiper.autoplay.stop();
  }
};

const resumeAutoplay = () => {
  if (swiperRef.value && swiperRef.value.swiper) {
    swiperRef.value.swiper.autoplay.start();
  }
};
const handleToLogin = () => {
  router.push({
    path: "/login",
  });
};
const handleGoTo = (link) => {
  if (link) {
    console.log("link", link);
    router.push(link);
  }
};
const swiperList = ref([
  {
    title: "虚拟仿真实验",
    desc: "海量标准资源一站集成，灵活定制随需而变",
    img: "/images/swipper/1.png",
    link: "/emulation",
  },
  {
    title: "AI实验助手",
    desc: "AI精准预判，个性服务",
    img: "/images/swipper/2.png",
    link: "/ai",
  },
  {
    title: "实验仪器百科",
    desc: "一册在手，实验无忧",
    img: "/images/swipper/3.png",
    link: "/wiki",
  },
  {
    title: "双端融合",
    desc: "网页与移动无缝合一，体验随屏而变",
    img: "/images/swipper/4.png",
    link: "",
  },
  {
    title: "仿真教学",
    desc: "让知识在虚拟中“活”起来",
    img: "/images/swipper/5.png",
    link: "/login",
  },
  {
    title: "数字化实验室",
    desc: "数据驱动实验，空间智能可控",
    img: "/images/swipper/6.png",
    link: "/laboratory",
  },
  {
    title: "数智赋能",
    desc: "智能提效，精准决策",
    img: "/images/swipper/7.png",
    link: "/login",
  },
  {
    title: "实验室AI数字人",
    desc: "科学知识能听会答，助力实验效率与灵感同步倍增",
    img: "/images/swipper/8.png",
    link: "/laboratory?szr=true",
  },
]);

// 若需要右侧图片跟着切换，就在list里再价格img字段
const menuList = ref([
  {
    title: "精准的专业知识库",
    content: "深度整合学科理论、实验规程与安全规范，确保解答内容科学准确",
  },
  {
    title: "即时响应",
    content: "实时解答问题，减少等待时间，提升学习效率",
  },
  {
    title: "自适应学习支持",
    content:
      "根据用户身份（教师/学生）和水平调整回答深度；记录常见问题，智能预测并提前提示关键操作风险或易错点",
  },
  {
    title: "教育安全与合规性保障",
    content: "符合教育数据隐私标准，不存储敏感个人信息",
  },
]);
const activeIndex = ref(0);
const switchMenu = (index) => {
  activeIndex.value = index;
};
const activeIndex2 = ref(0);
const menuList2 = [
  { title: "虚拟仿真" },
  { title: "降本增效" },
  { title: "个性化学习" },
  { title: "教学评估" },
];
const switchMenu2 = (index) => {
  activeIndex2.value = index;
};
</script>
<style lang="less" scoped>
.index-pages {
  width: 100%;
  .first-screen {
    width: 100%;
    height:calc(100vh - 90px);
    position: relative;
  }
  .index-info-box {
    position: absolute;
    top: 109px;
    left: 196px;
    .info-title {
      width: 490px;
      margin-bottom: 32px;
    }
    .info-content {
      font-family: SourceHanSansCN, SourceHanSansCN;
      font-weight: 400;
      font-size: 26px;
      color: #595959;
      line-height: 42px;
      text-align: left;
      font-style: normal;
      margin-bottom: 44px;
    }
    .info-button {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 207px;
      height: 64px;
      background: #1165ed;
      border-radius: 32px;
      cursor: pointer;
      .info-button-text {
        font-family: SourceHanSansCN, SourceHanSansCN;
        font-weight: 400;
        font-size: 24px;
        color: #ffffff;
        line-height: 36px;
        text-align: left;
        font-style: normal;
      }
      .info-button-icon {
        width: 24px;
        height: 24px;
        cursor: pointer;
      }
    }
  }
  .swipper-box {
    position: absolute;
    left: 192px;
    right: 192px;
    bottom: 72px;
    .swipper-item {
      width: 486px;
      height: 240px;
      background: #ffffff;
      border-radius: 16px;
      padding: 36px 30px;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      .swipper-item-img {
        width: 138px;
        height: 146px;
        margin-top: 12px;
        margin-right: 12px;
      }
      .swipper-item-title {
        width: 238px;
        height: 48px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 34px;
        color: #262626;
        line-height: 48px;
        text-align: left;
        font-style: normal;
        overflow: hidden;
        margin-bottom: 10px;
      }
      .swipper-item-desc {
        width: 238px;
        font-family: SourceHanSansCN, SourceHanSansCN;
        font-weight: 400;
        font-size: 18px;
        color: #595959;
        line-height: 24px;
        text-align: left;
        font-style: normal;
        height: 48px;
        margin-bottom: 16px;
      }
      .swipper-item-link {
        width: 115px;
        height: 40px;
        border-radius: 8px;
        border: 1px solid #8c8c8c;
        font-family: SourceHanSansCN, SourceHanSansCN;
        font-weight: 400;
        font-size: 18px;
        color: #8c8c8c;
        line-height: 40px;
        text-align: center;
        font-style: normal;
        cursor: pointer;
      }
    }
  }
}
.column-img {
  width: 1920px;
  vertical-align: top;
}
.column-1-box {
  width: 1920px;
  height: 910px;
  box-sizing: border-box;
  background: #ffffff;
  padding: 140px 200px 0px 200px;
  .main-box {
    width: 1520px;
    height: 630px;
    display: flex;
    justify-content: space-between;
    .box-lf {
      width: 370px;
      padding-top: 50px;
      .title {
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 50px;
        color: #000000;
        line-height: 60px;
        text-align: left;
        font-style: normal;
      }
      .menu-list {
        margin-top: 40px;
        .item {
          width: 370px;
          height: 70px;
          background: #f6f7f9;
          border-radius: 8px;
          line-height: 70px;
          cursor: pointer;
          margin-bottom: 12px;
          box-sizing: border-box;
          .title {
            line-height: 70px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 500;
            font-size: 16px;
            color: #262626;
            text-align: left;
            font-style: normal;
            position: relative;
            padding-left: 40px;
            &::before {
              content: "";
              position: absolute;
              width: 6px;
              height: 6px;
              border-radius: 3px;
              background-color: #262626;
              left: 24px;
              top: 32px;
            }
          }
          &.active {
            background-color: #fff;
            border-radius: 8px;
            border: 1px solid #e6ebf1;
            padding: 24px 24px 24px 40px;
            height: 122px;
            .title {
              padding: 0;
              line-height: 22px;
              height: 22px;
              &::before {
                left: -16px;
                top: 8px;
              }
            }
            .content {
              margin-top: 12px;
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 14px;
              color: #8c8c8c;
              line-height: 20px;
              text-align: left;
              font-style: normal;
            }
          }
        }
      }
    }
    .box-rt {
      width: 1070px;
      height: 630px;
      background: url("@/assets/home/img-1.png") no-repeat;
      background-size: 100% 100%;
    }
  }
}
.column-2-box {
  width: 1920px;
  height: 1060px;
  background: #f3f7fb;
  box-sizing: border-box;
  .title {
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 50px;
    color: #000000;
    line-height: 70px;
    text-align: left;
    font-style: normal;
    padding: 140px 0 90px 200px;
    background: #f3f7fb;
  }
  .out-box {
    position: relative;
    height: 615px;
    .bg {
      // 待解决：这里需要改用背景图片
      position: absolute;
      left: 0;
      top: 0;
      width: 1530px;
      height: 615px;
      background: linear-gradient(270deg, #72b7fa 0%, #1a5bdf 100%);
    }
  }
  .main-box {
    position: absolute;
    left: 200px;
    top: 0;
    width: 1520px;
    height: 615px;
    display: flex;
    justify-content: space-between;
    padding-top: 102px;
    .box-lf {
      width: 242px;
      padding-top: 20px;
      .lf-title {
        height: 42px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 30px;
        color: #ffffff;
        line-height: 42px;
        text-align: left;
        font-style: normal;
      }
      .lf-sub-title {
        height: 22px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 16px;
        color: #ffffff;
        line-height: 22px;
        text-align: left;
        font-style: normal;
        margin-top: 8px;
      }
      .menu-list {
        margin-top: 48px;
        .item {
          width: 242px;
          height: 56px;
          box-shadow: inset 1px 0px 0px 0px rgba(255, 255, 255, 0.3);
          box-sizing: border-box;
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          font-size: 18px;
          color: #ffffff;
          line-height: 56px;
          text-align: left;
          font-style: normal;
          padding-left: 26px;
          cursor: pointer;
          &.active {
            width: 242px;
            height: 56px;
            background: rgba(255, 255, 255, 0.1);
            box-shadow: inset 2px 0px 0px 0px #ffffff;
          }
        }
      }
    }
    .box-rt {
      box-sizing: border-box;
      width: 1174px;
      height: 400px;
      background: linear-gradient(90deg, #f5faff 0%, #ffffff 100%);
      box-shadow: 0px 12px 12px 0px rgba(20, 55, 125, 0.05);
      border-radius: 12px;
      padding: 50px 50px 0 50px;
      .rt-title {
        height: 33px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        font-size: 24px;
        color: #262626;
        line-height: 33px;
        text-align: left;
        font-style: normal;
      }
      .rt-content {
        margin-top: 20px;
        height: 75px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 18px;
        color: #595959;
        line-height: 25px;
        text-align: left;
        font-style: normal;
        padding-right: 235px;
        box-sizing: border-box;
      }
      .three {
        width: 100%;
        height: 119px;
        border-bottom: 1px solid #e6ebf1;
        padding-top: 57px;
        display: flex;
        box-sizing: border-box;
        .item {
          margin-right: 50px;
          display: flex;
          align-items: center;
          .icon {
            width: 24px;
            height: 20px;
            background: url(@/assets/check-images.png) no-repeat;
          }
          .text {
            margin-left: 14px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 18px;
            color: #5a5a5a;
            line-height: 25px;
            text-align: left;
            font-style: normal;
          }
        }
      }
      .btn {
        // 待解决：btn 里有个图标，切图拿不到
        width: 190px;
        height: 44px;
        background: #1165ed;
        border-radius: 4px;
        margin-top: 30px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 16px;
        color: #ffffff;
        line-height: 44px;
        text-align: left;
        font-style: normal;
        text-align: center;
        cursor: pointer;
      }
    }
  }
}
.column-3-box {
  width: 1920px;
  box-sizing: border-box;
  background: #cfcfcf;
  position: relative;
  .column-3-title {
    position: absolute;
    left: 150px;
    top: 125px;
    padding-left: 50px;
    padding-top: 20px;
    background: #fff;
    width: 600px;
    height: 80px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 50px;
    color: #000000;
    line-height: 70px;
    text-align: left;
    font-style: normal;
  }
}
.column-4-box {
  width: 1920px;
  padding-top: 110px;
  box-sizing: border-box;
  height: 630px;
  background: #f4f4f4;
}
.column-title {
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 32px;
  color: #262626;
  line-height: 45px;
  text-align: center;
  font-style: normal;
  margin-bottom: 54px;
}
.column-content {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  padding: 0 25px;
  justify-content: center;
  .logo-img {
    height: 90px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    margin: 0 16px 16px 0;
    img {
      height: 90px;
    }
  }
}
</style>
